CSharpTest.Net
BPlusTree.OptionsV2<TKey,TValue> Constructor(ISerializer<TKey>,ISerializer<TValue>)
See Also  Example Send Feedback Download Help File
CSharpTest.Net.BPlusTree Assembly > CSharpTest.Net.Collections Namespace > BPlusTree.OptionsV2<TKey,TValue> Class > BPlusTree.OptionsV2<TKey,TValue> Constructor : BPlusTree.OptionsV2<TKey,TValue> Constructor(ISerializer<TKey>,ISerializer<TValue>)

keySerializer
valueSerializer

Glossary Item Box

Constructs the options configuration to initialize a BPlusTree instance using the default Comparer for TKey

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal keySerializer As ISerializer(Of TKey), _
   ByVal valueSerializer As ISerializer(Of TValue) _
)
C# 
public BPlusTree.OptionsV2<TKey,TValue>( 
   ISerializer<TKey> keySerializer,
   ISerializer<TValue> valueSerializer
)

Parameters

keySerializer
valueSerializer

Example

BPlusTree/BPlusTree.Test/ThreadedMassInsertTest.cs

C#Copy Code
mreStop.Reset();
using(TempFile temp = new TempFile())
{
    BPlusTree<Guid, TestInfo>.OptionsV2 options = new BPlusTree<Guid, TestInfo>.OptionsV2(
        PrimitiveSerializer.Guid, new TestInfoSerializer());
    options.CalcBTreeOrder(16, 24);
    options.CreateFile = CreatePolicy.Always;
    options.FileName = temp.TempPath;
    using (BPlusTree<Guid, TestInfo> tree = new BPlusTree<Guid, TestInfo>(options))
    {
        tree.EnableCount();
        var actions = new List<IAsyncResult>();
        var tests = new Action<BPlusTree<Guid, TestInfo>>[] 
        {
            DeleteStuff, UpdateStuff, AddStuff, AddRanges, BulkyInserts,
            FetchStuff, FetchStuff, FetchStuff, FetchStuff, FetchStuff
        };

        foreach (var t in tests)
            actions.Add(t.BeginInvoke(tree, null, null));

        do
        {
            Trace.TraceInformation("Dictionary.Count = {0}", tree.Count);
            Thread.Sleep(1000);
        } while (Debugger.IsAttached);

        mreStop.Set();
        for (int i = 0; i < actions.Count; i++)
        {
            tests[i].EndInvoke(actions[i]);
        }

        Trace.TraceInformation("Dictionary.Count = {0}", tree.Count);
    }
}
VB.NETCopy Code
mreStop.Reset()
Using temp As New TempFile()
    Dim options As New BPlusTree(Of Guid, TestInfo).OptionsV2(PrimitiveSerializer.Guid, New TestInfoSerializer())
    options.CalcBTreeOrder(16, 24)
    options.CreateFile = CreatePolicy.Always
    options.FileName = temp.TempPath
    Using tree As New BPlusTree(Of Guid, TestInfo)(options)
        tree.EnableCount()
        Dim actions As var = New List(Of IAsyncResult)()
        Dim tests As var = New Action(Of BPlusTree(Of Guid, TestInfo))() {DeleteStuff, UpdateStuff, AddStuff, AddRanges, BulkyInserts, FetchStuff, _
            FetchStuff, FetchStuff, FetchStuff, FetchStuff}

        For Each t As var In tests
            actions.Add(t.BeginInvoke(tree, Nothing, Nothing))
        Next

        Do
            Trace.TraceInformation("Dictionary.Count = {0}", tree.Count)
            Thread.Sleep(1000)
        Loop While Debugger.IsAttached

        mreStop.[Set]()
        Dim i As Integer = 0
        While i < actions.Count
            tests(i).EndInvoke(actions(i))
            System.Math.Max(System.Threading.Interlocked.Increment(i),i - 1)
        End While

        Trace.TraceInformation("Dictionary.Count = {0}", tree.Count)
    End Using
End Using

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys